-- 猛犸

function initMammoth(self, buildingInfo, dbase, pos)
    if type(buildingInfo) ~= "table" then
        -- 没要求，配置错误
        error("获取不到猛犸配置！");
        return;
    end

    -- 获得猛犸冈布奥
    local function okFun()
        -- 尝试尝试触发
        DungeonActionM.go("slime_event", pos, 341);

        -- 直接移除相关的动画
        self.monsterNode.mammothDisplay:removeNormalAnimation();
        self.monsterNode.mammothDisplay = nil;
    end

    local petId = SlimeEventM.query(341, "dbase")["pet_id"];
    local bonusArgs = SlimeEventM.query(341, "bonus_args");

    local function onClicked(sender, eventType)
        if eventType == ccui.TouchEventType.ended then
            if self.gridData.state == GRID_STATE_DISABLE then
                -- 格子失效了
                return;
            end

            -- 更新建筑访问
            self:updateBuildingVisit();

            local iconPath = getHeroIconPath(PetM.getDefaultIcon(petId));
            self:openBuildingView(okFun, nil, nil, nil, nil, iconPath, nil, nil, {["scale"] = 1.18});

            AudioM.playFx("dup_shop");
        end
    end

    -- 猛犸模型
    local classId = dbase["monster_id"];
    local monsterDisplay = self:createMonsterDisplay(classId);
    self.monsterNode.mammothDisplay = monsterDisplay;
    self.monsterNode:addChild(monsterDisplay);
    self.monsterNode:setVisible(true);
    self.monsterNode:setScale(1.0);

    -- 模型偏移
    local dbase = MonsterM.query(classId, "dbase");
    local offset = dbase["model_offset"];
    if type(offset) == 'number' then
        self.monsterNode:setPositionY(self.monsterNode:getPositionY() + offset);
    end

    local iconPath = getLevelItemIconPath("default");
    local icon = ccui.ImageView:create(iconPath);
    icon:setOpacity(0);
    icon:setTouchEnabled(true);
    icon:setScale(1.5);
    self.item:addChild(icon);
    self.icon = icon;
    AddTouchEventListener(icon, onClicked);

    self.mammothEffect = true;
end

